import axios from 'axios';
import { stringify } from 'qs';

// const host = 'http://localhost';
const host = 'http://47.100.185.211';
// const host = 'http://10.1.16.55';
// const host = 'http://192.168.31.75';
export const audioFilePath = host + ':9999/Uploads/music';
export const wordPathUS = host + ':8888/us';
export const wordPathEN = host + ':8888/en';
export const axiosInstance = axios.create({
  // baseURL: 'http://localhost/api',
  // baseURL: 'http://47.100.185.211/eng.php',
  baseURL: host + '/api',
  transformRequest(data) {
    return stringify(data);
  },
});

try {
  axiosInstance.defaults.headers.common['token'] = JSON.parse(window.localStorage.getItem('userData')).token;
} catch (e) {
  console.log('localStorage userData parse error', e);
}
